<template>
    <div>
        <table>
            <tbody>
                
                <tr>
                    
                    <td>
                    <img :src="quinfor.photo" alt="" width="300" height="300" v-if="quinfor.photo!=''">
                    </td>
                </tr>
               
                
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import { idText } from 'typescript';
import { ref,reactive ,onMounted } from 'vue';
import { useRoute ,useRouter} from 'vue-router';
const route=useRoute();
const router=useRouter();

let quinfor:any=reactive({
    "id":route.query.id,
  "houseXm": "",
  "houseName": "",
  "houseType": "",
  "houseBz": "",
  "houseArea": "",
  "area": "",
  "photo": "",
  
})
const Img=(e:any)=>{
    
    var obj =e.target.files[0];
    let f=new FormData();
    f.append("file",obj)
    axios({
        url:'/api/Img/Imgs',
        method:'post',
        data:f
    })
    .then(res=>{
       
        quinfor.photo=res.data
        if(res.data=="文件格式不正确")
    {
         alert("文件格式不正确")
         return;
    }
    })
}
onMounted(()=>{
    ft();
})
const ft=()=>{
    axios({
        url:'/api/House/Houseft',
        method:'get',
        params:{
            id:route.query.id
        }
    })
    .then(res=>{
        Object.assign(quinfor,res.data)
    })
}

</script>

<style scoped>

</style>